package cn.mazexal.exambg.controller;

import cn.mazexal.exambg.common.models.PagedQry;
import cn.mazexal.exambg.common.models.PagedResponse;
import cn.mazexal.exambg.common.models.SingleResponse;
import cn.mazexal.exambg.models.qry.IDQry;
import cn.mazexal.exambg.models.qry.XmindQry;
import cn.mazexal.exambg.models.vo.XmindLogVO;
import cn.mazexal.exambg.services.ResourceService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Mazexal
 * Date: 2025/8/30
 */
@RestController
@RequestMapping("/resource")
public class ResourceController {

    @Resource
    private ResourceService resourceService;

    @RequestMapping("/getXmindLogList")
    public PagedResponse<XmindLogVO> getXmindLogList(@RequestBody XmindQry qry) {
        return PagedResponse.of(resourceService.getXmindLogList(qry));
    }

    @RequestMapping("/addXmindLog")
    public SingleResponse<Boolean> addXmindLog(@RequestBody XmindLogVO xmindLogVO) {
        return SingleResponse.of(resourceService.addXmindLog(xmindLogVO));
    }

    @RequestMapping("/updateXmindLog")
    public SingleResponse<Boolean> updateXmindLog(@RequestBody XmindLogVO xmindLogVO) {
        return SingleResponse.of(resourceService.updateXmindLog(xmindLogVO));
    }

    @RequestMapping("/deleteXmindLog")
    public SingleResponse<Boolean> deleteXmindLog(@RequestBody IDQry qry) {
        return SingleResponse.of(resourceService.deleteXmindLog(qry.getId()));
    }

}
